<template>
  <view class="like-list">
    <view v-for="item in likedPosts" :key="item.id" class="like-item">
      <view class="content">
        <text class="school">{{ item.schoolName }}</text>
        <text class="excerpt">{{ item.content.substring(0, 40) }}...</text>
      </view>
      <button @click="toggleLike(item.id)">取消点赞</button>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      likedPosts: [
        {
          id: 1,
          schoolName: '希望小学',
          content: '急需数学老师...',
          liked: true
        }
      ]
    }
  },
  methods: {
    toggleLike(id) {
      this.likedPosts = this.likedPosts.filter(item => item.id !== id)
      uni.showToast({ title: '已取消点赞' })
    }
  }
}
</script>

<style lang="scss" scoped>
.like-list {
  padding: 20rpx;
  
  .like-item {
    background: #fff;
    border-radius: 12rpx;
    padding: 25rpx;
    margin-bottom: 20rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    .content {
      flex: 1;
      margin-right: 20rpx;
      
      .school {
        font-size: 30rpx;
        color: #2c3e50;
        display: block;
        margin-bottom: 10rpx;
      }
      
      .excerpt {
        color: #666;
        font-size: 24rpx;
      }
    }
    
    button {
      background: #f0f0f0;
      color: #666;
      padding: 10rpx 20rpx;
      border-radius: 30rpx;
    }
  }
}
</style> 